<?php


namespace common\validate;

class StepReviewWorkflowRelation extends BaseValidate
{
    public $rule = [];

    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this;
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array');
    }

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data.name', 'require|max:128')
            ->append('data.code', 'max:128');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data.id', 'require')
            ->append('data.name', 'max:128')
            ->append('data.code', 'max:128');
    }


    // Delete 验证场景定义
    public function sceneDelete()
    {
        $this->append("param", 'require')
            ->append("param.filter", "require");
    }

    // SaveAllRelation 验证场景定义
    public function sceneSaveAllRelation()
    {
        return $this->append('data_list', 'require|array');
    }

    // SaveAllRelationItem 验证场景定义
    public function sceneSaveAllRelationItem()
    {
        return $this
            ->append('project_template_id', 'require|integer')
            ->append('step_workflow_id', 'require|integer')
            ->append('step_id', 'require|integer')
            ->append('attr_str', 'length:0,256');
    }

    // SelectProjectTemplateStepWorkflowReviewRelationTree 验证场景定义
    public function sceneSelectProjectTemplateStepWorkflowReviewRelationTree()
    {
        return $this
            ->append('param.filter.project_template_id', 'require|integer')
            ->append('param.filter.step_workflow_id', 'require|integer');
    }

    // SaveCheckListRoleCodeItem 验证场景定义
    public function sceneSaveCheckListRoleCodeItem()
    {
        return $this
            ->append('id', 'require|integer')
            ->append('review_role_config', 'length:0,256');
    }

    // SaveProjectTemplateReviewRelationItem 验证场景定义
    public function sceneSaveProjectTemplateReviewRelationItem()
    {
        return $this
            ->append('project_template_id', 'require|integer')
            ->append('step_workflow_id', 'require|integer')
            ->append('step_id', 'require|integer')
            ->append('attr_str', 'length:0,256');
    }


    // SaveAllReviewData 验证场景定义
    public function sceneSaveAllReviewData()
    {
        return $this
            ->append('check_list_role_data', 'array')
            ->append('review_relation_data', 'array');
    }

    // SelectReviewRelationTree 验证场景定义
    public function sceneSelectReviewRelationTree()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'require|array')
            ->append('param.page', 'require|array');
    }
}
